package cn.fl.mcr.service.impl;

import cn.fl.mcr.service.IMcrBillDReService;
import cn.fl.mcr.vo.McrBillDReVO;
import cn.lionbridgecapital.loan.model.condition.McrBillDReQC;
import cn.lionbridgecapital.loan.model.dto.McrBillDReDTO;
import cn.lionbridgecapital.loan.model.utils.CollectionUtils;
import cn.lionbridgecapital.loan.service.api.IMcrBillDReApiService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: pan.mw
 * @date: 2020/09/16
 * @since: JDK 1.8
 * @version: v1.0
 */
@Service
public class McrBillDReServiceImpl implements IMcrBillDReService {
    @Autowired
    private IMcrBillDReApiService mcrBillDReApiService;

    @Override
    public List<McrBillDReVO> searchList(McrBillDReQC qc) {
        List<McrBillDReDTO> mcrBillDReDTOS = mcrBillDReApiService.searchList(qc);
        if (CollectionUtils.isEmpty(mcrBillDReDTOS)) {
            return null;
        }
        List<McrBillDReVO> list = new ArrayList<>(mcrBillDReDTOS.size());
        McrBillDReVO vo = null;
        for (McrBillDReDTO mcrBillDReDTO : mcrBillDReDTOS) {
            vo = new McrBillDReVO();
            BeanUtils.copyProperties(mcrBillDReDTO, vo);
            list.add(vo);
        }
        return list;
    }
}
